home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutor.exe
/
ANSWERS
/
CH07_1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-15
|
926b
|
40 lines
#include "stdio.h"
#include "string.h"
void main()
{
int index;
char string1[6], string2[6], string3[6], all_three[18];
strcpy(string1, "one");
strcpy(string2, "two");
strcpy(string3, "three");
strcpy(all_three, string1);
strcat(all_three, " ");
strcat(all_three, string2);
strcat(all_three, " ");
strcat(all_three, string3);
for(index = 0 ; index < 10 ; index = index + 1)
printf("The final string is ---> %s\n", all_three);
}
/* Result of execution
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
The final string is ---> one two three
*/